/**
 * 
 */
package com.pocketpets.ui.map;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;

import com.google.android.maps.MapView;
import com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay;

/**
 * @author SumMac
 * 
 */
public abstract class FLayerBack extends BalloonItemizedOverlay<Spot> {

	// ================================================================
	// Fields
	// ================================================================

	protected ArrayList<Spot> spot = new ArrayList<Spot>();
	protected Context mContext;
	// private ArrayList<OverlayItem> m_overlays = new ArrayList<OverlayItem>();
	private Context c;

	// ================================================================
	// Constructors
	// ================================================================

	public FLayerBack(Drawable defaultMarker, MapView mapView) {
		super(boundCenter(defaultMarker), mapView);
		c = mapView.getContext();
	}

	// ================================================================
	// Inheried methods
	// ================================================================

	public void addOverlay(Spot overlay) {
		spot.add(overlay);
		populate();
	}

	@Override
	protected Spot createItem(int i) {
		return spot.get(i);
	}

	@Override
	public int size() {
		return spot.size();
	}

	// @Override
	// protected boolean onBalloonTap(int index, OverlayItem item) {
	// Toast.makeText(c, "onBalloonTap for overlay index " + index,
	// Toast.LENGTH_LONG).show();
	// return true;
	// }
	@Override
	protected abstract boolean onBalloonTap(int index, Spot item);

}
